package com.eastfair.enums;

import com.eastfair.annotation.base.BaseEnum;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;

import java.util.stream.Stream;

/**
 * 第三方账号平台类型枚举
 *
 * @author ligang
 */
@Getter
@ApiModel(value = "InterfaceAccountPlatformTypeEnum", description = "第三方账号平台类型枚举")
@AllArgsConstructor
@NoArgsConstructor
public enum InterfaceAccountPlatformTypeEnum implements BaseEnum {
    /**
     * THIRD_PART_EMAIL:THIRD_PART_EMAIL
     */
    THIRD_PART_EMAIL("THIRD_PART_EMAIL"),
    /**
     * THIRD_PART_JPUSH:THIRD_PART_JPUSH
     */
    THIRD_PART_JPUSH("THIRD_PART_JPUSH"),
    /**
     * THIRD_PART_IM:THIRD_PART_IM
     */
    THIRD_PART_IM("THIRD_PART_IM"),
    /**
     * THIRD_PART_SMS:THIRD_PART_SMS
     */
    THIRD_PART_SMS("THIRD_PART_SMS"),
    ;

    private String desc;

    public static InterfaceAccountPlatformTypeEnum match(String val, InterfaceAccountPlatformTypeEnum def) {
        return Stream.of(values()).parallel().filter((item) -> item.name().equalsIgnoreCase(val)).findAny().orElse(def);
    }

    public static InterfaceAccountPlatformTypeEnum get(String val) {
        return match(val, null);
    }

    public boolean eq(InterfaceAccountPlatformTypeEnum val) {
        return val == null ? false : eq(val.name());
    }

    @Override
    @ApiModelProperty(value = "编码", allowableValues = "", example = "")
    public String getCode() {
        return this.name();
    }
}
